#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N=1e5+5;

int n,r[N],buc1[N],buc2[N];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&r[i]);
        buc1[r[i]]++;// i rest
        buc2[r[i]]++;// i can attack
    }
    int l=1,r=2,ans=0;
    while(r<=N){
        while(buc1[l]==0&&l<=N) l++;
        r=max(l+1,r);
        while(buc2[r]==0&&r<=N) r++;
        if(buc1[l]<=buc2[r]){
            ans+=buc1[l];
            buc2[r]-=buc1[l];
            buc1[l]=0;
        }
        else {
            ans+=buc2[r];
            buc1[l]-=buc2[r];
            buc2[r]=0;
        }
    }
    printf("%d\n",n-ans);
    return 0;
}
/*
15
1 1 1 1 1 1 2 2 2 3 4 4 4 4 4

6
*/
